﻿using System;
using Mono.Cecil.PE;

namespace Mono.Cecil.Metadata
{
	// Token: 0x020000FA RID: 250
	internal sealed class DataBuffer : ByteBuffer
	{
		// Token: 0x06000A2A RID: 2602 RVA: 0x00005A02 File Offset: 0x00003C02
		public DataBuffer() : base(0)
		{
		}

		// Token: 0x06000A2B RID: 2603 RVA: 0x00005A14 File Offset: 0x00003C14
		private void Align(int align)
		{
			align--;
			base.WriteBytes((this.position + align & ~align) - this.position);
		}

		// Token: 0x06000A2C RID: 2604 RVA: 0x0002E27C File Offset: 0x0002C47C
		public uint AddData(byte[] data, int align)
		{
			bool flag = this.buffer_align < align;
			if (flag)
			{
				this.buffer_align = align;
			}
			this.Align(align);
			uint position = (uint)this.position;
			base.WriteBytes(data);
			return position;
		}

		// Token: 0x170002BA RID: 698
		// (get) Token: 0x06000A2D RID: 2605 RVA: 0x00005A35 File Offset: 0x00003C35
		public int BufferAlign
		{
			get
			{
				return this.buffer_align;
			}
		}

		// Token: 0x04000421 RID: 1057
		private int buffer_align = 4;
	}
}
